{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 数据分析三剑客\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "\n",
    "from pandas import Series,DataFrame"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Anaconda3\\envs\\venv\\lib\\site-packages\\IPython\\core\\interactiveshell.py:3058: DtypeWarning: Columns (13) have mixed types. Specify dtype option on import or set low_memory=False.\n",
      "  interactivity=interactivity, compiler=compiler, result=result)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>company</th>\n",
       "      <th>shixin_label</th>\n",
       "      <th>share_frost_all_cnt</th>\n",
       "      <th>share_frost_upper_cnt</th>\n",
       "      <th>share_frost_lower_cnt</th>\n",
       "      <th>share_frost_cnt_coc</th>\n",
       "      <th>share_frost_rhl</th>\n",
       "      <th>share_frost_cv</th>\n",
       "      <th>share_impawn_all_cnt</th>\n",
       "      <th>share_impawn_upper_cnt</th>\n",
       "      <th>...</th>\n",
       "      <th>net_senior_judgedoc_cnt</th>\n",
       "      <th>net_senior_judge_defendant_all_cnt</th>\n",
       "      <th>net_senior_judge_doc_upper_cnt</th>\n",
       "      <th>net_senior_judge_doc_lower_cnt</th>\n",
       "      <th>net_senior_judge_doc_rhl</th>\n",
       "      <th>net_senior_judge_doc_cnt_coc</th>\n",
       "      <th>net_senior_judge_doc_cv</th>\n",
       "      <th>net_fr_judgedoc_cnt</th>\n",
       "      <th>net_fr_judge_defendant_all_cnt</th>\n",
       "      <th>net_fr_judge_doc_upper_cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>无锡东灵汇医用技术有限公司</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>无锡买卖宝信息技术有限公司北京分公司</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>13</td>\n",
       "      <td>4.33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>无锡互联贸易有限公司</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>无锡五洲物业管理有限公司</td>\n",
       "      <td>1</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>无锡亚东硫化器制造有限公司</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 66 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "              company  shixin_label  share_frost_all_cnt  \\\n",
       "0       无锡东灵汇医用技术有限公司             1                  NaN   \n",
       "1  无锡买卖宝信息技术有限公司北京分公司             1                  NaN   \n",
       "2          无锡互联贸易有限公司             1                  NaN   \n",
       "3        无锡五洲物业管理有限公司             1                  1.0   \n",
       "4       无锡亚东硫化器制造有限公司             1                  NaN   \n",
       "\n",
       "   share_frost_upper_cnt  share_frost_lower_cnt  share_frost_cnt_coc  \\\n",
       "0                    NaN                    NaN                  NaN   \n",
       "1                    NaN                    NaN                  NaN   \n",
       "2                    NaN                    NaN                  NaN   \n",
       "3                    5.0                    0.0                  0.0   \n",
       "4                    NaN                    NaN                  NaN   \n",
       "\n",
       "   share_frost_rhl  share_frost_cv  share_impawn_all_cnt  \\\n",
       "0              NaN             NaN                   NaN   \n",
       "1              NaN             NaN                   NaN   \n",
       "2              NaN             NaN                   NaN   \n",
       "3              0.0             0.0                   3.0   \n",
       "4              NaN             NaN                   NaN   \n",
       "\n",
       "   share_impawn_upper_cnt  ...  net_senior_judgedoc_cnt  \\\n",
       "0                     NaN  ...                        0   \n",
       "1                     NaN  ...                        0   \n",
       "2                     NaN  ...                        0   \n",
       "3                     0.0  ...                        0   \n",
       "4                     NaN  ...                        0   \n",
       "\n",
       "   net_senior_judge_defendant_all_cnt  net_senior_judge_doc_upper_cnt  \\\n",
       "0                                   0                               0   \n",
       "1                                   0                               0   \n",
       "2                                   0                               0   \n",
       "3                                   0                               0   \n",
       "4                                   0                               0   \n",
       "\n",
       "  net_senior_judge_doc_lower_cnt  net_senior_judge_doc_rhl  \\\n",
       "0                            0.0                       0.0   \n",
       "1                            0.0                       0.0   \n",
       "2                            0.0                       0.0   \n",
       "3                            0.0                       0.0   \n",
       "4                            0.0                       0.0   \n",
       "\n",
       "   net_senior_judge_doc_cnt_coc  net_senior_judge_doc_cv  net_fr_judgedoc_cnt  \\\n",
       "0                           0.0                        0                    0   \n",
       "1                           0.0                        0                    0   \n",
       "2                           0.0                        0                    0   \n",
       "3                           0.0                        0                    0   \n",
       "4                           0.0                        0                    0   \n",
       "\n",
       "   net_fr_judge_defendant_all_cnt  net_fr_judge_doc_upper_cnt  \n",
       "0                               0                        0.00  \n",
       "1                              13                        4.33  \n",
       "2                               0                        0.00  \n",
       "3                               0                        0.00  \n",
       "4                               0                        0.00  \n",
       "\n",
       "[5 rows x 66 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "all_feature = pd.read_csv('../../data/all_features.csv')\n",
    "all_feature.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(4665023, 66)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "all_feature.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 4665023 entries, 0 to 4665022\n",
      "Data columns (total 66 columns):\n",
      "company                               4665023 non-null object\n",
      "shixin_label                          4665023 non-null int64\n",
      "share_frost_all_cnt                   1059420 non-null float64\n",
      "share_frost_upper_cnt                 1059420 non-null float64\n",
      "share_frost_lower_cnt                 1059420 non-null float64\n",
      "share_frost_cnt_coc                   1059420 non-null float64\n",
      "share_frost_rhl                       1059420 non-null float64\n",
      "share_frost_cv                        1059420 non-null float64\n",
      "share_impawn_all_cnt                  1059420 non-null float64\n",
      "share_impawn_upper_cnt                1059420 non-null float64\n",
      "share_impawn_lower_cnt                1059420 non-null float64\n",
      "share_impawn_cnt_coc                  1059420 non-null float64\n",
      "shares_transfer_all_cnt               1059420 non-null float64\n",
      "shares_transfer_upper_cnt             1078622 non-null object\n",
      "shares_transfer_lower_cnt             1059420 non-null float64\n",
      "shares_transfer_cnt_coc               1059420 non-null float64\n",
      "zczj                                  1059420 non-null float64\n",
      "clnx                                  1059420 non-null float64\n",
      "clnx_shixin_cnt                       1059420 non-null float64\n",
      "clnx_fw_all_cnt                       1059420 non-null float64\n",
      "clnx_normal_rate                      1059420 non-null float64\n",
      "clnx_shixin_rate                      1059420 non-null float64\n",
      "clnx_woe                              1059420 non-null float64\n",
      "clnx_iv                               1059420 non-null float64\n",
      "hy_normal_cnt                         1059420 non-null float64\n",
      "hy_shixin_cnt                         1059420 non-null float64\n",
      "hy_normal_rate                        4665023 non-null int64\n",
      "hy_shixin_rate                        4665023 non-null object\n",
      "hy_all_cnt                            4665023 non-null float64\n",
      "hy_woe                                4665023 non-null int64\n",
      "hy_iv                                 4665023 non-null int64\n",
      "zczj_all_cnt                          4665023 non-null int64\n",
      "zczj_shixin_cnt                       4665023 non-null int64\n",
      "zczj_normal_rate                      4665023 non-null int64\n",
      "zczj_shixin_rate                      4665023 non-null int64\n",
      "zczj_woe                              4665023 non-null int64\n",
      "zczj_iv                               4665023 non-null float64\n",
      "zczjbz_all_cnt                        4665023 non-null int64\n",
      "zczjbz_shixin_cnt                     4665023 non-null int64\n",
      "zczjbz_normal_rate                    4665023 non-null int64\n",
      "zczjbz_shixin_rate                    4665023 non-null int64\n",
      "zczjbz_woe                            4665023 non-null int64\n",
      "zczjbz_iv                             4665023 non-null int64\n",
      "province_all_cnt                      4665023 non-null float64\n",
      "province_shixin_cnt                   4665023 non-null int64\n",
      "province_normal_rate                  4665023 non-null int64\n",
      "province_shixin_rate                  4665023 non-null int64\n",
      "province_woe                          4665023 non-null int64\n",
      "province_iv                           4665023 non-null int64\n",
      "net_share_judgedoc_cnt                4665023 non-null int64\n",
      "net_share_judge_defendant_all_cnt     4665023 non-null int64\n",
      "net_share_judge_doc_upper_cnt         4665023 non-null int64\n",
      "net_share_judge_doc_lower_cnt         4665023 non-null int64\n",
      "net_share_judge_doc_rhl               4665023 non-null float64\n",
      "net_share_judge_doc_cnt_coc           4665023 non-null float64\n",
      "net_share_judge_doc_cv                4665023 non-null float64\n",
      "net_senior_judgedoc_cnt               4665023 non-null int64\n",
      "net_senior_judge_defendant_all_cnt    4665023 non-null int64\n",
      "net_senior_judge_doc_upper_cnt        4665023 non-null int64\n",
      "net_senior_judge_doc_lower_cnt        4665023 non-null float64\n",
      "net_senior_judge_doc_rhl              4665023 non-null float64\n",
      "net_senior_judge_doc_cnt_coc          4665023 non-null float64\n",
      "net_senior_judge_doc_cv               4665023 non-null int64\n",
      "net_fr_judgedoc_cnt                   4665023 non-null int64\n",
      "net_fr_judge_defendant_all_cnt        4665023 non-null int64\n",
      "net_fr_judge_doc_upper_cnt            4665023 non-null float64\n",
      "dtypes: float64(33), int64(30), object(3)\n",
      "memory usage: 2.3+ GB\n"
     ]
    }
   ],
   "source": [
    "all_feature.info(null_counts=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 缺失值用-1填充\n",
    "all_feature.fillna(-1,inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 4665023 entries, 0 to 4665022\n",
      "Data columns (total 66 columns):\n",
      "company                               4665023 non-null object\n",
      "shixin_label                          4665023 non-null int64\n",
      "share_frost_all_cnt                   4665023 non-null float64\n",
      "share_frost_upper_cnt                 4665023 non-null float64\n",
      "share_frost_lower_cnt                 4665023 non-null float64\n",
      "share_frost_cnt_coc                   4665023 non-null float64\n",
      "share_frost_rhl                       4665023 non-null float64\n",
      "share_frost_cv                        4665023 non-null float64\n",
      "share_impawn_all_cnt                  4665023 non-null float64\n",
      "share_impawn_upper_cnt                4665023 non-null float64\n",
      "share_impawn_lower_cnt                4665023 non-null float64\n",
      "share_impawn_cnt_coc                  4665023 non-null float64\n",
      "shares_transfer_all_cnt               4665023 non-null float64\n",
      "shares_transfer_upper_cnt             4665023 non-null object\n",
      "shares_transfer_lower_cnt             4665023 non-null float64\n",
      "shares_transfer_cnt_coc               4665023 non-null float64\n",
      "zczj                                  4665023 non-null float64\n",
      "clnx                                  4665023 non-null float64\n",
      "clnx_shixin_cnt                       4665023 non-null float64\n",
      "clnx_fw_all_cnt                       4665023 non-null float64\n",
      "clnx_normal_rate                      4665023 non-null float64\n",
      "clnx_shixin_rate                      4665023 non-null float64\n",
      "clnx_woe                              4665023 non-null float64\n",
      "clnx_iv                               4665023 non-null float64\n",
      "hy_normal_cnt                         4665023 non-null float64\n",
      "hy_shixin_cnt                         4665023 non-null float64\n",
      "hy_normal_rate                        4665023 non-null int64\n",
      "hy_shixin_rate                        4665023 non-null object\n",
      "hy_all_cnt                            4665023 non-null float64\n",
      "hy_woe                                4665023 non-null int64\n",
      "hy_iv                                 4665023 non-null int64\n",
      "zczj_all_cnt                          4665023 non-null int64\n",
      "zczj_shixin_cnt                       4665023 non-null int64\n",
      "zczj_normal_rate                      4665023 non-null int64\n",
      "zczj_shixin_rate                      4665023 non-null int64\n",
      "zczj_woe                              4665023 non-null int64\n",
      "zczj_iv                               4665023 non-null float64\n",
      "zczjbz_all_cnt                        4665023 non-null int64\n",
      "zczjbz_shixin_cnt                     4665023 non-null int64\n",
      "zczjbz_normal_rate                    4665023 non-null int64\n",
      "zczjbz_shixin_rate                    4665023 non-null int64\n",
      "zczjbz_woe                            4665023 non-null int64\n",
      "zczjbz_iv                             4665023 non-null int64\n",
      "province_all_cnt                      4665023 non-null float64\n",
      "province_shixin_cnt                   4665023 non-null int64\n",
      "province_normal_rate                  4665023 non-null int64\n",
      "province_shixin_rate                  4665023 non-null int64\n",
      "province_woe                          4665023 non-null int64\n",
      "province_iv                           4665023 non-null int64\n",
      "net_share_judgedoc_cnt                4665023 non-null int64\n",
      "net_share_judge_defendant_all_cnt     4665023 non-null int64\n",
      "net_share_judge_doc_upper_cnt         4665023 non-null int64\n",
      "net_share_judge_doc_lower_cnt         4665023 non-null int64\n",
      "net_share_judge_doc_rhl               4665023 non-null float64\n",
      "net_share_judge_doc_cnt_coc           4665023 non-null float64\n",
      "net_share_judge_doc_cv                4665023 non-null float64\n",
      "net_senior_judgedoc_cnt               4665023 non-null int64\n",
      "net_senior_judge_defendant_all_cnt    4665023 non-null int64\n",
      "net_senior_judge_doc_upper_cnt        4665023 non-null int64\n",
      "net_senior_judge_doc_lower_cnt        4665023 non-null float64\n",
      "net_senior_judge_doc_rhl              4665023 non-null float64\n",
      "net_senior_judge_doc_cnt_coc          4665023 non-null float64\n",
      "net_senior_judge_doc_cv               4665023 non-null int64\n",
      "net_fr_judgedoc_cnt                   4665023 non-null int64\n",
      "net_fr_judge_defendant_all_cnt        4665023 non-null int64\n",
      "net_fr_judge_doc_upper_cnt            4665023 non-null float64\n",
      "dtypes: float64(33), int64(30), object(3)\n",
      "memory usage: 2.3+ GB\n"
     ]
    }
   ],
   "source": [
    "all_feature.info(null_counts=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>company</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>shixin_label</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>4275942</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>389081</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              company\n",
       "shixin_label         \n",
       "1             4275942\n",
       "2              389081"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 查看样本平衡\n",
    "all_feature.groupby(by='shixin_label')[['company']].count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "10.989850442452857"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "4275942 / 389081"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 将失信标签改为0（未失信）和1（失信）\n",
    "mapping = {1:0,2:1}\n",
    "all_feature['shixin_label'] = all_feature['shixin_label'].map(mapping)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0, 1], dtype=int64)"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "all_feature.shixin_label.unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>share_frost_all_cnt</th>\n",
       "      <th>share_frost_upper_cnt</th>\n",
       "      <th>share_frost_lower_cnt</th>\n",
       "      <th>share_frost_cnt_coc</th>\n",
       "      <th>share_frost_rhl</th>\n",
       "      <th>share_frost_cv</th>\n",
       "      <th>share_impawn_all_cnt</th>\n",
       "      <th>share_impawn_upper_cnt</th>\n",
       "      <th>share_impawn_lower_cnt</th>\n",
       "      <th>share_impawn_cnt_coc</th>\n",
       "      <th>...</th>\n",
       "      <th>zczj</th>\n",
       "      <th>clnx</th>\n",
       "      <th>clnx_shixin_cnt</th>\n",
       "      <th>clnx_fw_all_cnt</th>\n",
       "      <th>clnx_normal_rate</th>\n",
       "      <th>clnx_shixin_rate</th>\n",
       "      <th>clnx_woe</th>\n",
       "      <th>clnx_iv</th>\n",
       "      <th>hy_normal_cnt</th>\n",
       "      <th>hy_shixin_cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4665018</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4665019</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4665020</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4665021</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4665022</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>4665023 rows × 24 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         share_frost_all_cnt  share_frost_upper_cnt  share_frost_lower_cnt  \\\n",
       "0                        NaN                    NaN                    NaN   \n",
       "1                        NaN                    NaN                    NaN   \n",
       "2                        NaN                    NaN                    NaN   \n",
       "3                        1.0                    5.0                    0.0   \n",
       "4                        NaN                    NaN                    NaN   \n",
       "...                      ...                    ...                    ...   \n",
       "4665018                  NaN                    NaN                    NaN   \n",
       "4665019                  NaN                    NaN                    NaN   \n",
       "4665020                  NaN                    NaN                    NaN   \n",
       "4665021                  NaN                    NaN                    NaN   \n",
       "4665022                  NaN                    NaN                    NaN   \n",
       "\n",
       "         share_frost_cnt_coc  share_frost_rhl  share_frost_cv  \\\n",
       "0                        NaN              NaN             NaN   \n",
       "1                        NaN              NaN             NaN   \n",
       "2                        NaN              NaN             NaN   \n",
       "3                        0.0              0.0             0.0   \n",
       "4                        NaN              NaN             NaN   \n",
       "...                      ...              ...             ...   \n",
       "4665018                  NaN              NaN             NaN   \n",
       "4665019                  NaN              NaN             NaN   \n",
       "4665020                  NaN              NaN             NaN   \n",
       "4665021                  NaN              NaN             NaN   \n",
       "4665022                  NaN              NaN             NaN   \n",
       "\n",
       "         share_impawn_all_cnt  share_impawn_upper_cnt  share_impawn_lower_cnt  \\\n",
       "0                         NaN                     NaN                     NaN   \n",
       "1                         NaN                     NaN                     NaN   \n",
       "2                         NaN                     NaN                     NaN   \n",
       "3                         3.0                     0.0                     0.0   \n",
       "4                         NaN                     NaN                     NaN   \n",
       "...                       ...                     ...                     ...   \n",
       "4665018                   NaN                     NaN                     NaN   \n",
       "4665019                   NaN                     NaN                     NaN   \n",
       "4665020                   NaN                     NaN                     NaN   \n",
       "4665021                   NaN                     NaN                     NaN   \n",
       "4665022                   NaN                     NaN                     NaN   \n",
       "\n",
       "         share_impawn_cnt_coc  ...  zczj clnx  clnx_shixin_cnt  \\\n",
       "0                         NaN  ...   NaN  NaN              NaN   \n",
       "1                         NaN  ...   NaN  NaN              NaN   \n",
       "2                         NaN  ...   NaN  NaN              NaN   \n",
       "3                         0.0  ...   0.0  0.0              0.0   \n",
       "4                         NaN  ...   NaN  NaN              NaN   \n",
       "...                       ...  ...   ...  ...              ...   \n",
       "4665018                   NaN  ...   NaN  NaN              NaN   \n",
       "4665019                   NaN  ...   NaN  NaN              NaN   \n",
       "4665020                   NaN  ...   NaN  NaN              NaN   \n",
       "4665021                   NaN  ...   NaN  NaN              NaN   \n",
       "4665022                   NaN  ...   NaN  NaN              NaN   \n",
       "\n",
       "         clnx_fw_all_cnt  clnx_normal_rate  clnx_shixin_rate  clnx_woe  \\\n",
       "0                    NaN               NaN               NaN       NaN   \n",
       "1                    NaN               NaN               NaN       NaN   \n",
       "2                    NaN               NaN               NaN       NaN   \n",
       "3                    0.0               0.0               0.0       0.0   \n",
       "4                    NaN               NaN               NaN       NaN   \n",
       "...                  ...               ...               ...       ...   \n",
       "4665018              NaN               NaN               NaN       NaN   \n",
       "4665019              NaN               NaN               NaN       NaN   \n",
       "4665020              NaN               NaN               NaN       NaN   \n",
       "4665021              NaN               NaN               NaN       NaN   \n",
       "4665022              NaN               NaN               NaN       NaN   \n",
       "\n",
       "         clnx_iv  hy_normal_cnt  hy_shixin_cnt  \n",
       "0            NaN            NaN            NaN  \n",
       "1            NaN            NaN            NaN  \n",
       "2            NaN            NaN            NaN  \n",
       "3            1.0            1.0            0.0  \n",
       "4            NaN            NaN            NaN  \n",
       "...          ...            ...            ...  \n",
       "4665018      NaN            NaN            NaN  \n",
       "4665019      NaN            NaN            NaN  \n",
       "4665020      NaN            NaN            NaN  \n",
       "4665021      NaN            NaN            NaN  \n",
       "4665022      NaN            NaN            NaN  \n",
       "\n",
       "[4665023 rows x 24 columns]"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "all_feature_miss = all_feature.iloc[:,2:27].copy()\n",
    "all_feature_miss"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 4665023 entries, 0 to 4665022\n",
      "Data columns (total 24 columns):\n",
      "share_frost_all_cnt          1059420 non-null float64\n",
      "share_frost_upper_cnt        1059420 non-null float64\n",
      "share_frost_lower_cnt        1059420 non-null float64\n",
      "share_frost_cnt_coc          1059420 non-null float64\n",
      "share_frost_rhl              1059420 non-null float64\n",
      "share_frost_cv               1059420 non-null float64\n",
      "share_impawn_all_cnt         1059420 non-null float64\n",
      "share_impawn_upper_cnt       1059420 non-null float64\n",
      "share_impawn_lower_cnt       1059420 non-null float64\n",
      "share_impawn_cnt_coc         1059420 non-null float64\n",
      "shares_transfer_all_cnt      1059420 non-null float64\n",
      "shares_transfer_upper_cnt    1078622 non-null object\n",
      "shares_transfer_lower_cnt    1059420 non-null float64\n",
      "shares_transfer_cnt_coc      1059420 non-null float64\n",
      "zczj                         1059420 non-null float64\n",
      "clnx                         1059420 non-null float64\n",
      "clnx_shixin_cnt              1059420 non-null float64\n",
      "clnx_fw_all_cnt              1059420 non-null float64\n",
      "clnx_normal_rate             1059420 non-null float64\n",
      "clnx_shixin_rate             1059420 non-null float64\n",
      "clnx_woe                     1059420 non-null float64\n",
      "clnx_iv                      1059420 non-null float64\n",
      "hy_normal_cnt                1059420 non-null float64\n",
      "hy_shixin_cnt                1059420 non-null float64\n",
      "dtypes: float64(23), object(1)\n",
      "memory usage: 854.2+ MB\n"
     ]
    }
   ],
   "source": [
    "all_feature_miss.info(null_counts=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([nan, '0', '-1011125', ..., 1570430.0, -236758.0, -109002.0],\n",
       "      dtype=object)"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "all_feature_miss.shares_transfer_upper_cnt.unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "cond = all_feature_miss['shares_transfer_upper_cnt'].notnull()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>share_frost_all_cnt</th>\n",
       "      <th>share_frost_upper_cnt</th>\n",
       "      <th>share_frost_lower_cnt</th>\n",
       "      <th>share_frost_cnt_coc</th>\n",
       "      <th>share_frost_rhl</th>\n",
       "      <th>share_frost_cv</th>\n",
       "      <th>share_impawn_all_cnt</th>\n",
       "      <th>share_impawn_upper_cnt</th>\n",
       "      <th>share_impawn_lower_cnt</th>\n",
       "      <th>share_impawn_cnt_coc</th>\n",
       "      <th>...</th>\n",
       "      <th>zczj</th>\n",
       "      <th>clnx</th>\n",
       "      <th>clnx_shixin_cnt</th>\n",
       "      <th>clnx_fw_all_cnt</th>\n",
       "      <th>clnx_normal_rate</th>\n",
       "      <th>clnx_shixin_rate</th>\n",
       "      <th>clnx_woe</th>\n",
       "      <th>clnx_iv</th>\n",
       "      <th>hy_normal_cnt</th>\n",
       "      <th>hy_shixin_cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4664998</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4665002</th>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4665008</th>\n",
       "      <td>1.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4665010</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4665011</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1078622 rows × 24 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         share_frost_all_cnt  share_frost_upper_cnt  share_frost_lower_cnt  \\\n",
       "3                        1.0                    5.0                    0.0   \n",
       "13                       0.0                    0.0                    0.0   \n",
       "14                       1.0                    1.0                    0.0   \n",
       "15                       1.0                    5.0                    0.0   \n",
       "20                       0.0                    0.0                    0.0   \n",
       "...                      ...                    ...                    ...   \n",
       "4664998                  0.0                    0.0                    0.0   \n",
       "4665002                  1.0                    1.0                    0.0   \n",
       "4665008                  1.0                   19.0                    0.0   \n",
       "4665010                  0.0                    0.0                    0.0   \n",
       "4665011                  0.0                    0.0                    0.0   \n",
       "\n",
       "         share_frost_cnt_coc  share_frost_rhl  share_frost_cv  \\\n",
       "3                        0.0              0.0             0.0   \n",
       "13                       0.0              0.0             0.0   \n",
       "14                       0.0              0.0             0.0   \n",
       "15                       2.0              5.0             5.0   \n",
       "20                       0.0              0.0             0.0   \n",
       "...                      ...              ...             ...   \n",
       "4664998                  0.0              0.0             0.0   \n",
       "4665002                  1.0              1.0             1.0   \n",
       "4665008                 15.0             19.0            19.0   \n",
       "4665010                  0.0              0.0             0.0   \n",
       "4665011                  0.0              0.0             0.0   \n",
       "\n",
       "         share_impawn_all_cnt  share_impawn_upper_cnt  share_impawn_lower_cnt  \\\n",
       "3                         3.0                     0.0                     0.0   \n",
       "13                        0.0                     0.0                     0.0   \n",
       "14                        0.0                     0.0                     0.0   \n",
       "15                        4.0                     0.0                     0.0   \n",
       "20                        0.0                     0.0                     0.0   \n",
       "...                       ...                     ...                     ...   \n",
       "4664998                   0.0                     0.0                     0.0   \n",
       "4665002                   0.0                     0.0                     1.0   \n",
       "4665008                  15.0                     0.0                     0.0   \n",
       "4665010                   0.0                     0.0                     0.0   \n",
       "4665011                   0.0                     0.0                     0.0   \n",
       "\n",
       "         share_impawn_cnt_coc  ...  zczj clnx  clnx_shixin_cnt  \\\n",
       "3                         0.0  ...   0.0  0.0              0.0   \n",
       "13                        0.0  ...   0.0  0.0              0.0   \n",
       "14                        0.0  ...   0.0  0.0              0.0   \n",
       "15                        0.0  ...   0.0  0.0              0.0   \n",
       "20                        0.0  ...   0.0  0.0              0.0   \n",
       "...                       ...  ...   ...  ...              ...   \n",
       "4664998                   0.0  ...   0.0  0.0              0.0   \n",
       "4665002                   0.0  ...   0.0  0.0              0.0   \n",
       "4665008                   0.0  ...   6.0  3.0              5.0   \n",
       "4665010                   0.0  ...   0.0  0.0              0.0   \n",
       "4665011                   0.0  ...   0.0  0.0              0.0   \n",
       "\n",
       "         clnx_fw_all_cnt  clnx_normal_rate  clnx_shixin_rate  clnx_woe  \\\n",
       "3                    0.0               0.0               0.0       0.0   \n",
       "13                   0.0               0.0               0.0       0.0   \n",
       "14                   0.0               1.0               1.0       0.0   \n",
       "15                   0.0               0.0               0.0       0.0   \n",
       "20                   0.0               0.0               0.0       0.0   \n",
       "...                  ...               ...               ...       ...   \n",
       "4664998              0.0               0.0               0.0       0.0   \n",
       "4665002              0.0               0.0               0.0       0.0   \n",
       "4665008              6.0               0.0               0.0       0.0   \n",
       "4665010              0.0               0.0               0.0       0.0   \n",
       "4665011              0.0               0.0               0.0       0.0   \n",
       "\n",
       "         clnx_iv  hy_normal_cnt  hy_shixin_cnt  \n",
       "3            1.0            1.0            0.0  \n",
       "13           0.0            0.0            0.0  \n",
       "14           0.0            0.0            0.0  \n",
       "15           1.0            1.0            0.0  \n",
       "20           0.0            0.0            0.0  \n",
       "...          ...            ...            ...  \n",
       "4664998      0.0            0.0            0.0  \n",
       "4665002      0.0            0.0            0.0  \n",
       "4665008      1.0            5.0            2.0  \n",
       "4665010      0.0            0.0            0.0  \n",
       "4665011      0.0            0.0            0.0  \n",
       "\n",
       "[1078622 rows x 24 columns]"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "all_feature_miss[cond]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [],
   "source": [
    "unique = all_feature.hy_shixin_rate.unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "def convert(item):\n",
    "        index = np.argwhere(unique == item)[0,0]\n",
    "        return index\n",
    "all_feature['hy_shixin_rate'] = all_feature['hy_shixin_rate'].map(convert)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "all_feature.fillna(-1,inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>company</th>\n",
       "      <th>shixin_label</th>\n",
       "      <th>share_frost_all_cnt</th>\n",
       "      <th>share_frost_upper_cnt</th>\n",
       "      <th>share_frost_lower_cnt</th>\n",
       "      <th>share_frost_cnt_coc</th>\n",
       "      <th>share_frost_rhl</th>\n",
       "      <th>share_frost_cv</th>\n",
       "      <th>share_impawn_all_cnt</th>\n",
       "      <th>share_impawn_upper_cnt</th>\n",
       "      <th>...</th>\n",
       "      <th>net_senior_judgedoc_cnt</th>\n",
       "      <th>net_senior_judge_defendant_all_cnt</th>\n",
       "      <th>net_senior_judge_doc_upper_cnt</th>\n",
       "      <th>net_senior_judge_doc_lower_cnt</th>\n",
       "      <th>net_senior_judge_doc_rhl</th>\n",
       "      <th>net_senior_judge_doc_cnt_coc</th>\n",
       "      <th>net_senior_judge_doc_cv</th>\n",
       "      <th>net_fr_judgedoc_cnt</th>\n",
       "      <th>net_fr_judge_defendant_all_cnt</th>\n",
       "      <th>net_fr_judge_doc_upper_cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>无锡东灵汇医用技术有限公司</td>\n",
       "      <td>1</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>无锡买卖宝信息技术有限公司北京分公司</td>\n",
       "      <td>1</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>13</td>\n",
       "      <td>4.33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>无锡互联贸易有限公司</td>\n",
       "      <td>1</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>无锡五洲物业管理有限公司</td>\n",
       "      <td>1</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>无锡亚东硫化器制造有限公司</td>\n",
       "      <td>1</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 66 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "              company  shixin_label  share_frost_all_cnt  \\\n",
       "0       无锡东灵汇医用技术有限公司             1                 -1.0   \n",
       "1  无锡买卖宝信息技术有限公司北京分公司             1                 -1.0   \n",
       "2          无锡互联贸易有限公司             1                 -1.0   \n",
       "3        无锡五洲物业管理有限公司             1                  1.0   \n",
       "4       无锡亚东硫化器制造有限公司             1                 -1.0   \n",
       "\n",
       "   share_frost_upper_cnt  share_frost_lower_cnt  share_frost_cnt_coc  \\\n",
       "0                   -1.0                   -1.0                 -1.0   \n",
       "1                   -1.0                   -1.0                 -1.0   \n",
       "2                   -1.0                   -1.0                 -1.0   \n",
       "3                    5.0                    0.0                  0.0   \n",
       "4                   -1.0                   -1.0                 -1.0   \n",
       "\n",
       "   share_frost_rhl  share_frost_cv  share_impawn_all_cnt  \\\n",
       "0             -1.0            -1.0                  -1.0   \n",
       "1             -1.0            -1.0                  -1.0   \n",
       "2             -1.0            -1.0                  -1.0   \n",
       "3              0.0             0.0                   3.0   \n",
       "4             -1.0            -1.0                  -1.0   \n",
       "\n",
       "   share_impawn_upper_cnt  ...  net_senior_judgedoc_cnt  \\\n",
       "0                    -1.0  ...                        0   \n",
       "1                    -1.0  ...                        0   \n",
       "2                    -1.0  ...                        0   \n",
       "3                     0.0  ...                        0   \n",
       "4                    -1.0  ...                        0   \n",
       "\n",
       "   net_senior_judge_defendant_all_cnt  net_senior_judge_doc_upper_cnt  \\\n",
       "0                                   0                               0   \n",
       "1                                   0                               0   \n",
       "2                                   0                               0   \n",
       "3                                   0                               0   \n",
       "4                                   0                               0   \n",
       "\n",
       "  net_senior_judge_doc_lower_cnt  net_senior_judge_doc_rhl  \\\n",
       "0                            0.0                       0.0   \n",
       "1                            0.0                       0.0   \n",
       "2                            0.0                       0.0   \n",
       "3                            0.0                       0.0   \n",
       "4                            0.0                       0.0   \n",
       "\n",
       "   net_senior_judge_doc_cnt_coc  net_senior_judge_doc_cv  net_fr_judgedoc_cnt  \\\n",
       "0                           0.0                        0                    0   \n",
       "1                           0.0                        0                    0   \n",
       "2                           0.0                        0                    0   \n",
       "3                           0.0                        0                    0   \n",
       "4                           0.0                        0                    0   \n",
       "\n",
       "   net_fr_judge_defendant_all_cnt  net_fr_judge_doc_upper_cnt  \n",
       "0                               0                        0.00  \n",
       "1                              13                        4.33  \n",
       "2                               0                        0.00  \n",
       "3                               0                        0.00  \n",
       "4                               0                        0.00  \n",
       "\n",
       "[5 rows x 66 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "all_feature.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>shixin_label</th>\n",
       "      <th>share_frost_all_cnt</th>\n",
       "      <th>share_frost_upper_cnt</th>\n",
       "      <th>share_frost_lower_cnt</th>\n",
       "      <th>share_frost_cnt_coc</th>\n",
       "      <th>share_frost_rhl</th>\n",
       "      <th>share_frost_cv</th>\n",
       "      <th>share_impawn_all_cnt</th>\n",
       "      <th>share_impawn_upper_cnt</th>\n",
       "      <th>share_impawn_lower_cnt</th>\n",
       "      <th>...</th>\n",
       "      <th>net_senior_judgedoc_cnt</th>\n",
       "      <th>net_senior_judge_defendant_all_cnt</th>\n",
       "      <th>net_senior_judge_doc_upper_cnt</th>\n",
       "      <th>net_senior_judge_doc_lower_cnt</th>\n",
       "      <th>net_senior_judge_doc_rhl</th>\n",
       "      <th>net_senior_judge_doc_cnt_coc</th>\n",
       "      <th>net_senior_judge_doc_cv</th>\n",
       "      <th>net_fr_judgedoc_cnt</th>\n",
       "      <th>net_fr_judge_defendant_all_cnt</th>\n",
       "      <th>net_fr_judge_doc_upper_cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>...</td>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>4.665023e+06</td>\n",
       "      <td>4.665023e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>1.083404e+00</td>\n",
       "      <td>-6.248739e-01</td>\n",
       "      <td>8.963913e-01</td>\n",
       "      <td>-7.729014e-01</td>\n",
       "      <td>-3.055702e-01</td>\n",
       "      <td>1.100228e-01</td>\n",
       "      <td>5.758325e-01</td>\n",
       "      <td>1.229319e-01</td>\n",
       "      <td>-7.709392e-01</td>\n",
       "      <td>-6.776198e-01</td>\n",
       "      <td>...</td>\n",
       "      <td>2.508026e-04</td>\n",
       "      <td>7.869415e-03</td>\n",
       "      <td>2.673084e-04</td>\n",
       "      <td>8.277130e-05</td>\n",
       "      <td>2.599464e-03</td>\n",
       "      <td>8.821178e-05</td>\n",
       "      <td>4.443065e-03</td>\n",
       "      <td>1.808437e-02</td>\n",
       "      <td>5.866661e-01</td>\n",
       "      <td>1.953158e-01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>2.764917e-01</td>\n",
       "      <td>7.283281e-01</td>\n",
       "      <td>2.669778e+01</td>\n",
       "      <td>4.189568e-01</td>\n",
       "      <td>8.998300e+00</td>\n",
       "      <td>1.630315e+01</td>\n",
       "      <td>2.570629e+01</td>\n",
       "      <td>1.763138e+01</td>\n",
       "      <td>5.237292e-01</td>\n",
       "      <td>5.274819e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>1.587532e-02</td>\n",
       "      <td>9.121300e-02</td>\n",
       "      <td>1.634739e-02</td>\n",
       "      <td>5.239673e-03</td>\n",
       "      <td>3.015654e-02</td>\n",
       "      <td>5.394637e-03</td>\n",
       "      <td>4.974118e-01</td>\n",
       "      <td>2.066978e+00</td>\n",
       "      <td>5.456111e+00</td>\n",
       "      <td>1.818702e+00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>-1.000000e+00</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000e+00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>2.000000e+00</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>9.439000e+03</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>4.128000e+03</td>\n",
       "      <td>5.352000e+03</td>\n",
       "      <td>9.438000e+03</td>\n",
       "      <td>7.316000e+03</td>\n",
       "      <td>4.060000e+02</td>\n",
       "      <td>3.792000e+03</td>\n",
       "      <td>...</td>\n",
       "      <td>2.000000e+00</td>\n",
       "      <td>3.000000e+00</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>6.700000e-01</td>\n",
       "      <td>1.000000e+00</td>\n",
       "      <td>3.300000e-01</td>\n",
       "      <td>4.140000e+02</td>\n",
       "      <td>1.876000e+03</td>\n",
       "      <td>4.580000e+03</td>\n",
       "      <td>1.526670e+03</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8 rows × 63 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       shixin_label  share_frost_all_cnt  share_frost_upper_cnt  \\\n",
       "count  4.665023e+06         4.665023e+06           4.665023e+06   \n",
       "mean   1.083404e+00        -6.248739e-01           8.963913e-01   \n",
       "std    2.764917e-01         7.283281e-01           2.669778e+01   \n",
       "min    1.000000e+00        -1.000000e+00          -1.000000e+00   \n",
       "25%    1.000000e+00        -1.000000e+00          -1.000000e+00   \n",
       "50%    1.000000e+00        -1.000000e+00          -1.000000e+00   \n",
       "75%    1.000000e+00        -1.000000e+00          -1.000000e+00   \n",
       "max    2.000000e+00         1.000000e+00           9.439000e+03   \n",
       "\n",
       "       share_frost_lower_cnt  share_frost_cnt_coc  share_frost_rhl  \\\n",
       "count           4.665023e+06         4.665023e+06     4.665023e+06   \n",
       "mean           -7.729014e-01        -3.055702e-01     1.100228e-01   \n",
       "std             4.189568e-01         8.998300e+00     1.630315e+01   \n",
       "min            -1.000000e+00        -1.000000e+00    -1.000000e+00   \n",
       "25%            -1.000000e+00        -1.000000e+00    -1.000000e+00   \n",
       "50%            -1.000000e+00        -1.000000e+00    -1.000000e+00   \n",
       "75%            -1.000000e+00        -1.000000e+00    -1.000000e+00   \n",
       "max             0.000000e+00         4.128000e+03     5.352000e+03   \n",
       "\n",
       "       share_frost_cv  share_impawn_all_cnt  share_impawn_upper_cnt  \\\n",
       "count    4.665023e+06          4.665023e+06            4.665023e+06   \n",
       "mean     5.758325e-01          1.229319e-01           -7.709392e-01   \n",
       "std      2.570629e+01          1.763138e+01            5.237292e-01   \n",
       "min     -1.000000e+00         -1.000000e+00           -1.000000e+00   \n",
       "25%     -1.000000e+00         -1.000000e+00           -1.000000e+00   \n",
       "50%     -1.000000e+00         -1.000000e+00           -1.000000e+00   \n",
       "75%     -1.000000e+00         -1.000000e+00           -1.000000e+00   \n",
       "max      9.438000e+03          7.316000e+03            4.060000e+02   \n",
       "\n",
       "       share_impawn_lower_cnt  ...  net_senior_judgedoc_cnt  \\\n",
       "count            4.665023e+06  ...             4.665023e+06   \n",
       "mean            -6.776198e-01  ...             2.508026e-04   \n",
       "std              5.274819e+00  ...             1.587532e-02   \n",
       "min             -1.000000e+00  ...             0.000000e+00   \n",
       "25%             -1.000000e+00  ...             0.000000e+00   \n",
       "50%             -1.000000e+00  ...             0.000000e+00   \n",
       "75%             -1.000000e+00  ...             0.000000e+00   \n",
       "max              3.792000e+03  ...             2.000000e+00   \n",
       "\n",
       "       net_senior_judge_defendant_all_cnt  net_senior_judge_doc_upper_cnt  \\\n",
       "count                        4.665023e+06                    4.665023e+06   \n",
       "mean                         7.869415e-03                    2.673084e-04   \n",
       "std                          9.121300e-02                    1.634739e-02   \n",
       "min                          0.000000e+00                    0.000000e+00   \n",
       "25%                          0.000000e+00                    0.000000e+00   \n",
       "50%                          0.000000e+00                    0.000000e+00   \n",
       "75%                          0.000000e+00                    0.000000e+00   \n",
       "max                          3.000000e+00                    1.000000e+00   \n",
       "\n",
       "       net_senior_judge_doc_lower_cnt  net_senior_judge_doc_rhl  \\\n",
       "count                    4.665023e+06              4.665023e+06   \n",
       "mean                     8.277130e-05              2.599464e-03   \n",
       "std                      5.239673e-03              3.015654e-02   \n",
       "min                      0.000000e+00              0.000000e+00   \n",
       "25%                      0.000000e+00              0.000000e+00   \n",
       "50%                      0.000000e+00              0.000000e+00   \n",
       "75%                      0.000000e+00              0.000000e+00   \n",
       "max                      6.700000e-01              1.000000e+00   \n",
       "\n",
       "       net_senior_judge_doc_cnt_coc  net_senior_judge_doc_cv  \\\n",
       "count                  4.665023e+06             4.665023e+06   \n",
       "mean                   8.821178e-05             4.443065e-03   \n",
       "std                    5.394637e-03             4.974118e-01   \n",
       "min                    0.000000e+00             0.000000e+00   \n",
       "25%                    0.000000e+00             0.000000e+00   \n",
       "50%                    0.000000e+00             0.000000e+00   \n",
       "75%                    0.000000e+00             0.000000e+00   \n",
       "max                    3.300000e-01             4.140000e+02   \n",
       "\n",
       "       net_fr_judgedoc_cnt  net_fr_judge_defendant_all_cnt  \\\n",
       "count         4.665023e+06                    4.665023e+06   \n",
       "mean          1.808437e-02                    5.866661e-01   \n",
       "std           2.066978e+00                    5.456111e+00   \n",
       "min           0.000000e+00                    0.000000e+00   \n",
       "25%           0.000000e+00                    0.000000e+00   \n",
       "50%           0.000000e+00                    0.000000e+00   \n",
       "75%           0.000000e+00                    0.000000e+00   \n",
       "max           1.876000e+03                    4.580000e+03   \n",
       "\n",
       "       net_fr_judge_doc_upper_cnt  \n",
       "count                4.665023e+06  \n",
       "mean                 1.953158e-01  \n",
       "std                  1.818702e+00  \n",
       "min                  0.000000e+00  \n",
       "25%                  0.000000e+00  \n",
       "50%                  0.000000e+00  \n",
       "75%                  0.000000e+00  \n",
       "max                  1.526670e+03  \n",
       "\n",
       "[8 rows x 63 columns]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "all_feature.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "shixin_label 2\n",
      "share_frost_all_cnt 3\n",
      "share_frost_upper_cnt 1222\n",
      "share_frost_lower_cnt 2\n",
      "share_frost_cnt_coc 602\n",
      "share_frost_rhl 895\n",
      "share_frost_cv 1169\n",
      "share_impawn_all_cnt 894\n",
      "share_impawn_upper_cnt 53\n",
      "share_impawn_lower_cnt 354\n",
      "share_impawn_cnt_coc 294\n",
      "shares_transfer_all_cnt 54\n",
      "shares_transfer_upper_cnt 111879\n",
      "shares_transfer_lower_cnt 2119\n",
      "shares_transfer_cnt_coc 3\n",
      "zczj 201\n",
      "clnx 132\n",
      "clnx_shixin_cnt 171\n",
      "clnx_fw_all_cnt 184\n",
      "clnx_normal_rate 3\n",
      "clnx_shixin_rate 517\n",
      "clnx_woe 316\n",
      "clnx_iv 3\n",
      "hy_normal_cnt 258\n",
      "hy_shixin_cnt 104\n",
      "hy_normal_rate 1393\n",
      "hy_shixin_rate 29\n",
      "hy_all_cnt 86441\n",
      "hy_woe 21\n",
      "hy_iv 87\n",
      "zczj_all_cnt 137\n",
      "zczj_shixin_cnt 54\n",
      "zczj_normal_rate 96\n",
      "zczj_shixin_rate 438\n",
      "zczj_woe 438\n",
      "zczj_iv 392\n",
      "zczjbz_all_cnt 1040\n",
      "zczjbz_shixin_cnt 257\n",
      "zczjbz_normal_rate 49\n",
      "zczjbz_shixin_rate 1763\n",
      "zczjbz_woe 230\n",
      "zczjbz_iv 587\n",
      "province_all_cnt 587\n",
      "province_shixin_cnt 2\n",
      "province_normal_rate 3\n",
      "province_shixin_rate 3\n",
      "province_woe 3\n",
      "province_iv 3\n",
      "net_share_judgedoc_cnt 2\n",
      "net_share_judge_defendant_all_cnt 3\n",
      "net_share_judge_doc_upper_cnt 4\n",
      "net_share_judge_doc_lower_cnt 4\n",
      "net_share_judge_doc_rhl 3\n",
      "net_share_judge_doc_cnt_coc 4\n",
      "net_share_judge_doc_cv 4\n",
      "net_senior_judgedoc_cnt 3\n",
      "net_senior_judge_defendant_all_cnt 4\n",
      "net_senior_judge_doc_upper_cnt 2\n",
      "net_senior_judge_doc_lower_cnt 3\n",
      "net_senior_judge_doc_rhl 4\n",
      "net_senior_judge_doc_cnt_coc 2\n",
      "net_senior_judge_doc_cv 67\n",
      "net_fr_judgedoc_cnt 176\n",
      "net_fr_judge_defendant_all_cnt 415\n",
      "net_fr_judge_doc_upper_cnt 415\n"
     ]
    }
   ],
   "source": [
    "for col in all_feature.columns[1:]:\n",
    "    unique = all_feature[col].unique()\n",
    "#     print(unique)\n",
    "    print(col,len(unique))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "mapping = {1:0,2:1}\n",
    "all_feature['shixin_label'] = all_feature['shixin_label'].map(mapping)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0, 1], dtype=int64)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "all_feature['shixin_label'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(4665023, 64)"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>share_frost_all_cnt</th>\n",
       "      <th>share_frost_upper_cnt</th>\n",
       "      <th>share_frost_lower_cnt</th>\n",
       "      <th>share_frost_cnt_coc</th>\n",
       "      <th>share_frost_rhl</th>\n",
       "      <th>share_frost_cv</th>\n",
       "      <th>share_impawn_all_cnt</th>\n",
       "      <th>share_impawn_upper_cnt</th>\n",
       "      <th>share_impawn_lower_cnt</th>\n",
       "      <th>share_impawn_cnt_coc</th>\n",
       "      <th>...</th>\n",
       "      <th>net_senior_judgedoc_cnt</th>\n",
       "      <th>net_senior_judge_defendant_all_cnt</th>\n",
       "      <th>net_senior_judge_doc_upper_cnt</th>\n",
       "      <th>net_senior_judge_doc_lower_cnt</th>\n",
       "      <th>net_senior_judge_doc_rhl</th>\n",
       "      <th>net_senior_judge_doc_cnt_coc</th>\n",
       "      <th>net_senior_judge_doc_cv</th>\n",
       "      <th>net_fr_judgedoc_cnt</th>\n",
       "      <th>net_fr_judge_defendant_all_cnt</th>\n",
       "      <th>net_fr_judge_doc_upper_cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>13</td>\n",
       "      <td>4.33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 64 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   share_frost_all_cnt  share_frost_upper_cnt  share_frost_lower_cnt  \\\n",
       "0                 -1.0                   -1.0                   -1.0   \n",
       "1                 -1.0                   -1.0                   -1.0   \n",
       "2                 -1.0                   -1.0                   -1.0   \n",
       "3                  1.0                    5.0                    0.0   \n",
       "4                 -1.0                   -1.0                   -1.0   \n",
       "\n",
       "   share_frost_cnt_coc  share_frost_rhl  share_frost_cv  share_impawn_all_cnt  \\\n",
       "0                 -1.0             -1.0            -1.0                  -1.0   \n",
       "1                 -1.0             -1.0            -1.0                  -1.0   \n",
       "2                 -1.0             -1.0            -1.0                  -1.0   \n",
       "3                  0.0              0.0             0.0                   3.0   \n",
       "4                 -1.0             -1.0            -1.0                  -1.0   \n",
       "\n",
       "   share_impawn_upper_cnt  share_impawn_lower_cnt  share_impawn_cnt_coc  ...  \\\n",
       "0                    -1.0                    -1.0                  -1.0  ...   \n",
       "1                    -1.0                    -1.0                  -1.0  ...   \n",
       "2                    -1.0                    -1.0                  -1.0  ...   \n",
       "3                     0.0                     0.0                   0.0  ...   \n",
       "4                    -1.0                    -1.0                  -1.0  ...   \n",
       "\n",
       "   net_senior_judgedoc_cnt net_senior_judge_defendant_all_cnt  \\\n",
       "0                        0                                  0   \n",
       "1                        0                                  0   \n",
       "2                        0                                  0   \n",
       "3                        0                                  0   \n",
       "4                        0                                  0   \n",
       "\n",
       "   net_senior_judge_doc_upper_cnt  net_senior_judge_doc_lower_cnt  \\\n",
       "0                               0                             0.0   \n",
       "1                               0                             0.0   \n",
       "2                               0                             0.0   \n",
       "3                               0                             0.0   \n",
       "4                               0                             0.0   \n",
       "\n",
       "   net_senior_judge_doc_rhl  net_senior_judge_doc_cnt_coc  \\\n",
       "0                       0.0                           0.0   \n",
       "1                       0.0                           0.0   \n",
       "2                       0.0                           0.0   \n",
       "3                       0.0                           0.0   \n",
       "4                       0.0                           0.0   \n",
       "\n",
       "   net_senior_judge_doc_cv  net_fr_judgedoc_cnt  \\\n",
       "0                        0                    0   \n",
       "1                        0                    0   \n",
       "2                        0                    0   \n",
       "3                        0                    0   \n",
       "4                        0                    0   \n",
       "\n",
       "   net_fr_judge_defendant_all_cnt  net_fr_judge_doc_upper_cnt  \n",
       "0                               0                        0.00  \n",
       "1                              13                        4.33  \n",
       "2                               0                        0.00  \n",
       "3                               0                        0.00  \n",
       "4                               0                        0.00  \n",
       "\n",
       "[5 rows x 64 columns]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "features = all_feature.iloc[:,2:]\n",
    "display(features.shape,features.head(5))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0, 0, 0, ..., 0, 0, 0], dtype=int64)"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "target = all_feature.shixin_label.values.copy()\n",
    "target"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.ensemble import RandomForestClassifier\n",
    "from sklearn.model_selection import train_test_split"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_train,X_test,y_train,y_test = train_test_split(features,target,test_size=0.1,random_state=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(4198520, 64)"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "(466503, 64)"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(X_train.shape,X_test.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "share_frost_all_cnt               float64\n",
       "share_frost_upper_cnt             float64\n",
       "share_frost_lower_cnt             float64\n",
       "share_frost_cnt_coc               float64\n",
       "share_frost_rhl                   float64\n",
       "                                   ...   \n",
       "net_senior_judge_doc_cnt_coc      float64\n",
       "net_senior_judge_doc_cv             int64\n",
       "net_fr_judgedoc_cnt                 int64\n",
       "net_fr_judge_defendant_all_cnt      int64\n",
       "net_fr_judge_doc_upper_cnt        float64\n",
       "Length: 64, dtype: object"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_train.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "ename": "ValueError",
     "evalue": "could not convert string to float: ",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mValueError\u001b[0m                                Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-28-bfa03c04d5d2>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[0mrfc\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mRandomForestClassifier\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mn_estimators\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m100\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mmax_depth\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m3\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mn_jobs\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mrfc\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfit\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mX_train\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0my_train\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;32mC:\\Anaconda3\\envs\\venv\\lib\\site-packages\\sklearn\\ensemble\\_forest.py\u001b[0m in \u001b[0;36mfit\u001b[1;34m(self, X, y, sample_weight)\u001b[0m\n\u001b[0;32m    293\u001b[0m         \"\"\"\n\u001b[0;32m    294\u001b[0m         \u001b[1;31m# Validate or convert input data\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 295\u001b[1;33m         \u001b[0mX\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mcheck_array\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mX\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0maccept_sparse\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"csc\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mDTYPE\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    296\u001b[0m         \u001b[0my\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mcheck_array\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0maccept_sparse\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m'csc'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mensure_2d\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mFalse\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mNone\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    297\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0msample_weight\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mC:\\Anaconda3\\envs\\venv\\lib\\site-packages\\sklearn\\utils\\validation.py\u001b[0m in \u001b[0;36mcheck_array\u001b[1;34m(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, warn_on_dtype, estimator)\u001b[0m\n\u001b[0;32m    513\u001b[0m                     \u001b[0marray\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0marray\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mastype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcasting\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"unsafe\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcopy\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mFalse\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    514\u001b[0m                 \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 515\u001b[1;33m                     \u001b[0marray\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0masarray\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0marray\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0morder\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0morder\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    516\u001b[0m             \u001b[1;32mexcept\u001b[0m \u001b[0mComplexWarning\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    517\u001b[0m                 raise ValueError(\"Complex data not supported\\n\"\n",
      "\u001b[1;32mC:\\Anaconda3\\envs\\venv\\lib\\site-packages\\numpy\\core\\_asarray.py\u001b[0m in \u001b[0;36masarray\u001b[1;34m(a, dtype, order)\u001b[0m\n\u001b[0;32m     83\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     84\u001b[0m     \"\"\"\n\u001b[1;32m---> 85\u001b[1;33m     \u001b[1;32mreturn\u001b[0m \u001b[0marray\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcopy\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mFalse\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0morder\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0morder\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m     86\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     87\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mValueError\u001b[0m: could not convert string to float: "
     ]
    }
   ],
   "source": [
    "rfc = RandomForestClassifier(n_estimators=100,max_depth=3,n_jobs=-1)\n",
    "rfc.fit(X_train,y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [conda env:venv]",
   "language": "python",
   "name": "conda-env-venv-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
